package com.linkit.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.content.res.AssetManager;

import com.linkit.main.MainActivity;

public class DataTest {

	public static String readAssets(String fileName) {
		AssetManager assetManager = MainActivity.getInstance().getAssets();
		BufferedReader br = null;
		StringBuffer sb = new StringBuffer("");
		try {
			InputStream inputStream = assetManager.open(fileName);
			br = new BufferedReader(new InputStreamReader(inputStream));
			String line = "";
			while ((line = br.readLine()) != null) {
				sb.append(line);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (br != null) {
				try {
					br.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return sb.toString();
	}
}
